﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Controls="clr-namespace:PSE.Framework.UI.Controls.SmartClient;assembly=PSE.Framework.UI.Controls">
    
    <Style TargetType="{x:Type Controls:ProgressBar}">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
        <Setter Property="MinHeight" Value="36"/>
        <Setter Property="MinWidth" Value="50"/>
        <Setter Property="Width" Value="100"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:ProgressBar}">
                    <StackPanel x:Name="PART_StackControl" Orientation="Vertical">
                        <StackPanel Orientation="Horizontal" x:Name="PART_Description">
                            <TextBlock VerticalAlignment="Top" Text="{Binding ProgressBarText, RelativeSource={RelativeSource TemplatedParent}}" TextWrapping="Wrap" Foreground="{DynamicResource BrushProgressBarDescription}" HorizontalAlignment="Left" Width="Auto" TextAlignment="Left" Height="15"/>
                        </StackPanel>
                        <Border VerticalAlignment="Stretch" CornerRadius="0,0,0,0" BorderBrush="{DynamicResource BrushProgressBarBorderColor}" BorderThickness="1,1,1,1" Background="{DynamicResource BrushProgressBarBorderBackground}" MinWidth="{TemplateBinding MinWidth}" Width="{TemplateBinding Width}">
                            <DockPanel Margin="0,0,0,0" x:Name="PART_Track" LastChildFill="false">
                                <Rectangle x:Name="PART_Indicator" Fill="{DynamicResource BrushProgressBarBorderFill}" MinHeight="15"/>
                            </DockPanel>
                        </Border>
                        <StackPanel Orientation="Horizontal" x:Name="PART_ProgressDescription">
                            <TextBlock VerticalAlignment="Top"  Text="{Binding ProgressBarValue, RelativeSource={RelativeSource TemplatedParent}}" TextWrapping="Wrap" Foreground="{DynamicResource BrushProgressVarForegroundColor}" HorizontalAlignment="Left" MinWidth="40" TextAlignment="Left" Height="15" Width="Auto"/>
                        </StackPanel>
                    </StackPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ShowDescription" Value="False" >
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Description" />
                        </Trigger>
                        <Trigger Property="ShowDescription" Value="True" >
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_Description"  />
                        </Trigger>
                        <Trigger Property="ShowProgressDescription" Value="False" >
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_ProgressDescription"  />
                        </Trigger>
                        <Trigger Property="ShowProgressDescription" Value="True" >
                            <Setter Property="Visibility" Value="Visible" TargetName="PART_ProgressDescription"  />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ProgressBar}">
                            <Border VerticalAlignment="Bottom" Height="30" Width="500" CornerRadius="0,0,0,0" BorderBrush="{DynamicResource BrushProgressBarBorderColor}" BorderThickness="0,0,2,2" Background="{DynamicResource BrushProgressBarBorderBackground}">
                                <DockPanel Margin="0,0,2,2" x:Name="PART_Track" LastChildFill="false">
                                    <Decorator x:Name="PART_Indicator" DockPanel.Dock="Bottom">
                                        <Rectangle>
                                            <Rectangle.LayoutTransform>
                                                <RotateTransform Angle="-90"/>
                                            </Rectangle.LayoutTransform>
                                            <!--<Rectangle.Fill>
                                                <MultiBinding>
                                                    <Binding Path="Foreground" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                    <Binding Path="IsIndeterminate" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                    <Binding Path="ActualHeight" ElementName="PART_Indicator"/>
                                                    <Binding Path="ActualWidth" ElementName="PART_Indicator"/>
                                                    <Binding Path="ActualHeight" ElementName="PART_Track"/>
                                                </MultiBinding>
                                            </Rectangle.Fill>-->
                                        </Rectangle>
                                    </Decorator>
                                </DockPanel>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>
